import java.sql.Timestamp;
import java.util.Date;

public class Borrow {
    int id;
    String book_name;
    String isbn;
    String username;
    String id_card;
    String phone;
    Timestamp borrow_time;
    Timestamp return_time;

    public Borrow(int id, String book_name, String isbn, String username, String id_card, String phone, Timestamp borrow_time, Timestamp return_time) {
        this.id = id;
        this.book_name = book_name;
        this.isbn = isbn;
        this.username = username;
        this.id_card = id_card;
        this.phone = phone;
        this.borrow_time = borrow_time;
        this.return_time = return_time;
    }

    public Borrow() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getBook_name() {
        return book_name;
    }

    public void setBook_name(String book_name) {
        this.book_name = book_name;
    }

    public String getIsbn() {
        return isbn;
    }

    public void setIsbn(String isbn) {
        this.isbn = isbn;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getId_card() {
        return id_card;
    }

    public void setId_card(String id_card) {
        this.id_card = id_card;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Timestamp getBorrow_time() {
        return borrow_time;
    }

    public void setBorrow_time(Timestamp borrow_time) {
        this.borrow_time = borrow_time;
    }

    public Timestamp getReturn_time() {
        return return_time;
    }

    public void setReturn_time(Timestamp return_time) {
        this.return_time = return_time;
    }

    /*public boolean Timeout_or_not(){
        Date date1 = new Date(this.borrow_time.getTime());
        Date date2 = new Date(this.return_time.getTime());
        int comparison = date1.compareTo(date2);
        if(comparison>0)
        {
           return true;
        }
        return false;
    }*/
    public boolean Timeout_or_not() {
        long tenMinutesInMillis = 10 * 60 * 1000; // 10分钟的毫秒数

        Date borrowTimePlusTenMinutes = new Date(this.borrow_time.getTime() + tenMinutesInMillis);
        int comparison = this.return_time.compareTo(borrowTimePlusTenMinutes);

        return comparison > 0;
    }

}
